using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace NetworkPower.DataAccess.Models.Mapping
{
    public class EquipmentMap : EntityTypeConfiguration<Equipment>
    {
        public EquipmentMap()
        {
            // Primary Key
            this.HasKey(t => new { t.EquipmentID, t.EquipmentName, t.SeparationID });

            // Properties
            this.Property(t => t.EquipmentName)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.EquipmentType)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Equipments");
            this.Property(t => t.EquipmentID).HasColumnName("EquipmentID");
            this.Property(t => t.EquipmentName).HasColumnName("EquipmentName");
            this.Property(t => t.EquipmentType).HasColumnName("EquipmentType");
            this.Property(t => t.SeparationID).HasColumnName("SeparationID");
        }
    }
}
